﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using PortfolioApp.Data;
using PortfolioApp.DataModels;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity;
using PortfolioApp.Web.IDataAdapters.Interfaces;
using PortfolioApp.Web.IDataAdapters.Adapters;

namespace PortfolioApp.Web.Controllers
{
    public class ngPostsController : ApiController
    {
        IPortfolioAppAdapter _adapter = new PortfolioAppAdapter();
        public IHttpActionResult GET(int id, int id2)
        {
            return Ok(_adapter.GetSome(id, id2));
        }
        public IHttpActionResult GET()
        {

            return Ok(_adapter.GetAllPosts());
        }
        public IHttpActionResult GET(int id)
        {

            return Ok(_adapter.GetPost(id));
        }
        public IHttpActionResult POST(Post post)
        {

            return Ok(_adapter.AddPost(post));
        }
        public IHttpActionResult PUT(Post post)
        {

            return Ok(_adapter.UpdatePost(post));
        }
        public IHttpActionResult DELETE(int id)
        {
            _adapter.DeletePost(id);
            return Ok();
        }

    }
}
